using System;
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
using Eco.Persistence;


namespace CycleGrams
{
	public partial class CycleGramsPMP : Eco.Persistence.PersistenceMapperProvider
	{
		#region Eco Managed Code
		private void DoGenerateDB()
		{
			if (PersistenceMapper is PersistenceMapperDb)
				(PersistenceMapper as PersistenceMapperDb).CreateDataBaseSchema(GetTypeSystemService(true), new DefaultCleanPsConfig(true));
			else
				throw new InvalidOperationException("The PersistenceMapper is not a PersistenceMapperDb");
		}
		/// <summary>
		/// Returns the singleton instance of the PersistenceMapperProvider.
		/// </summary>
		public static CycleGramsPMP Instance
		{
			get
			{
				return GetInstance<CycleGramsPMP>();
			}
		}
		#endregion

		public CycleGramsPMP(): base()
		{
			InitializeComponent();
		}

		/// <summary>
		/// Regenerates the database schema, no questions asked.
		/// </summary>
		public static void GenerateDB()
		{
			Instance.DoGenerateDB();
		}
	}
}
